package com.chinawayltd.ews.sample.service.algorithm.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chinawayltd.ews.sample.core.exception.BusinessException;
import com.chinawayltd.ews.sample.mapper.TDriverMapper;
import com.chinawayltd.ews.sample.mapper.algorithm.DriverExtendMapper;
import com.chinawayltd.ews.sample.model.TDriver;
import com.chinawayltd.ews.sample.service.algorithm.DriverService;
import com.chinawayltd.ews.sample.util.StringUtils;

/**
 * @program: greeProject
 * @description 
 * @author: chenxin
 * @create: 2018年5月23日 下午4:49:20
 */
@Service
public class DriverServiceImpl implements DriverService{

    @Autowired
    DriverExtendMapper driverExtendMapper;
    @Autowired
    TDriverMapper tDriverMapper;

	@Override
	public List<TDriver> getDriverByPhone(String phone) throws Exception {
		// 判断id是否为空
    	if(StringUtils.isBlank(phone)){
            throw new BusinessException("数据不能为空");
        }
		return driverExtendMapper.getDriverByPhone(phone);
	}

	@Override
	public TDriver getDriverById(Long id) throws Exception {
		return tDriverMapper.selectByPrimaryKey(id);
	}

	

 
}
